home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / MISC / HCAL-27 / WIRECOND.BAS (.txt) < prev    next >
Encoding:
GW-BASIC  |  1997-01-29  |  4.6 KB  |  180 lines

  1. 10  'WIRECOND - Maximum number of wires in a conduit - 11 MAR 96 rev. 28 SEP 96
  2. 20  IF EX$=""THEN EX$="EXIT"
  3. 30  CLS:KEY OFF
  4. 40  COLOR 7,0,1
  5. 50  UL$=STRING$(80,205)
  6. 60  U1$="##,###.###"
  7. 70  U2$="##,###"
  8. 80  I$="conduit inside diameter"
  9. 90  O$="wire/cable outside diameter"
  10. 100  N$="number of wires/cables"
  11. 110  '
  12. 120  COLOR 15,2
  13. 130  PRINT " WIRES in CONDUIT";TAB(57)"by George Murphy VE3ERP ";
  14. 140  COLOR 1,0:PRINT STRING$(80,223);
  15. 150  COLOR 7,0
  16. 160  GOSUB 1410    'preface
  17. 170  PRINT
  18. 180  COLOR 0,7
  19. 190  LOCATE ,23
  20. 200  PRINT " Press 1 to continue or 0 to EXIT..."
  21. 210  COLOR 7,0
  22. 220  Z$=INKEY$:IF Z$=""THEN 220
  23. 230  IF Z$="1"THEN 260
  24. 240  IF Z$="0"THEN CLS:RUN EX$
  25. 250  GOTO 220
  26. 260  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  27. 270  '
  28. 280  '.....start
  29. 290  ID=0:OD=0:NW=0
  30. 300  ID$="Specified "
  31. 310  OD$="Specified "
  32. 320  NW$="Specified "
  33. 330  PRINT " Enter dimensions in any unit (e.g. inches, millimetres etc.)
  34. 340  PRINT " The results will be displayed in the same units.
  35. 350  PRINT
  36. 360  PRINT " Two of the following factors must be known."
  37. 370  PRINT " Press number in ( ) to identify the UNKNOWN factor....."
  38. 380  PRINT UL$;
  39. 390  PRINT "   (1) ";I$
  40. 400  PRINT "   (2) ";O$
  41. 410  PRINT "   (3) ";N$
  42. 420  Z$=INKEY$:IF Z$=""THEN 420
  43. 430  IF Z$="1"THEN Y$=I$:GOTO 480
  44. 440  IF Z$="2"THEN Y$=O$:GOTO 480
  45. 450  IF Z$="3"THEN Y$=N$:GOTO 480
  46. 460  GOTO 420
  47. 470  '
  48. 480  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  49. 490  PRINT " To find ";Y$;":"
  50. 500  PRINT
  51. 510  IF Y$=I$ OR ID<>0 GOTO 530
  52. 520  PRINT " ENTER: ";I$;:INPUT ID:GOSUB 590
  53. 530  IF Y$=O$ OR OD<>0 GOTO 550
  54. 540  PRINT " ENTER: ";O$;:INPUT OD:GOSUB 590
  55. 550  IF Y$=N$ OR NW<>0 GOTO 570
  56. 560  PRINT " ENTER: ";N$;:INPUT NW:GOSUB 590
  57. 570  GOTO 510
  58. 580  '
  59. 590  IF ID*OD<>0 THEN 1000
  60. 600  IF ID*NW<>0 THEN 1130
  61. 610  IF OD*NW<>0 THEN 1260
  62. 620  RETURN
  63. 630  '
  64. 640  '.....display results
  65. 650  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  66. 660  PRINT TAB(26)"WIRES/CABLES PACKED IN A CONDUIT"
  67. 670  PRINT TAB(15);STRING$(52,205)"
  68. 680  PRINT TAB(15)NW$;N$;STRING$(32-LEN(N$),".");USING U2$;NW
  69. 690  PRINT TAB(15)OD$;O$;STRING$(32-LEN(O$),".");USING U1$;OD
  70. 700  PRINT TAB(15)ID$;I$;STRING$(32-LEN(I$),".");USING U1$;ID
  71. 710  PRINT
  72. 720  PRINT TAB(5)"* ";Y$;" includes packing clearance allowances."
  73. 730  PRINT UL$;
  74. 740  PRINT
  75. 750  COLOR 15,4
  76. 760  LOCATE ,31:PRINT " KEYTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENCLOSE "
  77. 770  LOCATE ,31:PRINT " OPEN W A R N I N G OPEN "
  78. 780  LOCATE ,31:PRINT " SCREENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENTHENLOAD "
  79. 790  COLOR 7,0
  80. 800  PRINT
  81. 810  T=7
  82. 820  PRINT TAB(T);
  83. 830  PRINT "The overriding factor governing the maximum number of conductors"
  84. 840  PRINT TAB(T);
  85. 850  PRINT "in a conduit is the danger of fire due to heat build-up caused by"
  86. 860  PRINT TAB(T);
  87. 870  PRINT "current flow through the conductors."
  88. 880  PRINT
  89. 890  COLOR 12
  90. 900  PRINT TAB(T);
  91. 910  PRINT "The maximum number of conductors allowed by your local Electrical"
  92. 920  PRINT TAB(T);
  93. 930  PRINT "Codes may be less than the maximum number of conductors that will"
  94. 940  PRINT TAB(T);
  95. 950  PRINT "physically fit into the conduit."
  96. 960  COLOR 7
  97. 970  GOTO 1620
  98. 980  END
  99. 990  '
  100. 1000  '.....Conduit ID (D) and wire OD known
  101. 1010  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3:GOSUB 1380
  102. 1020  N=0:NW$="Maximum * "
  103. 1030  N=N+0.01      'number of complete layers
  104. 1040  W=3*N^2+3*N+1:D=(2*N+1)*OD:GOSUB 1090
  105. 1050  W=3*N^2+5*N+2:D=(2*N+2)*OD:GOSUB 1090
  106. 1060  W=3*N^2+6*N+3:D=(1+2*SQR(N^2+N+1/3))*OD:GOSUB 1090
  107. 1070  W=3*N^2+7*N+4:D=(1+SQR(4*N^2+5.644*N+2))*OD:GOSUB 1090
  108. 1080  GOTO 1030
  109. 1090  IF D>=ID THEN 640
  110. 1100  NW=W
  111. 1110  RETURN
  112. 1120  '
  113. 1130  '.....Conduit ID (ID) and number of wires (NW) known
  114. 1140  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3:GOSUB 1380
  115. 1150  N=0:OD$="Maximum * "
  116. 1160  N=N+0.01      'number of complete layers
  117. 1170  W=3*N^2+3*N+1:WD=ID/(2*N+1):GOSUB 1220
  118. 1180  W=3*N^2+5*N+2:WD=ID/(2*N+2):GOSUB 1220
  119. 1190  W=3*N^2+6*N+3:WD=ID/(1+2*SQR(N^2+N+1/3)):GOSUB 1220
  120. 1200  W=3*N^2+7*N+4:WD=ID/(1+SQR(4*N^2+5.644*N+2)):GOSUB 1220
  121. 1210  GOTO 1160
  122. 1220  IF W>=NW THEN 640
  123. 1230  OD=WD
  124. 1240  RETURN
  125. 1250  '
  126. 1260  '.....Wire OD (OD) and number of wires (NW) known
  127. 1270  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3:GOSUB 1380
  128. 1280  N=0:ID$="Minimum * "
  129. 1290  N=N+1      'number of complete layers
  130. 1300  W=3*N^2+3*N+1:WD=(2*N+1)*OD:GOSUB 1350
  131. 1310  W=3*N^2+5*N+2:WD=(2*N+2)*OD:GOSUB 1350
  132. 1320  W=3*N^2+6*N+3:WD=(1+2*SQR(N^2+N+1/3))*OD:GOSUB 1350
  133. 1330  W=3*N^2+7*N+4:WD=(1+SQR(4*N^2+5.644*N+2))*OD:GOSUB 1350
  134. 1340  GOTO 1290
  135. 1350  IF W>=NW THEN ID=2*SQR(((WD/2)^2)*1.02):GOTO 640
  136. 1360  RETURN
  137. 1370  '
  138. 1380  PRINT " CALCULATING BY ITERATION - PLEASE WAIT...."
  139. 1390  RETURN
  140. 1400  '
  141. 1410  '.....preface
  142. 1420  T=8
  143. 1430  PRINT TAB(T);
  144. 1440  PRINT "This program computes the geometry of a circle enclosing a given"
  145. 1450  PRINT TAB(T);
  146. 1460  PRINT "number of smaller circles all of the same size, such as a conduit"
  147. 1470  PRINT TAB(T);
  148. 1480  PRINT "or hole surrounding a number of same-size wires or cables."
  149. 1490  PRINT
  150. 1500  PRINT TAB(T);
  151. 1510  PRINT "The calculations are based on formulae published in Machinery's"
  152. 1520  PRINT TAB(T);
  153. 1530  PRINT "Handbook, Revised 21st Edition, pages 86-87, adjusted to provide"
  154. 1540  PRINT TAB(T);
  155. 1550  PRINT "clearances to ease the near-impossible task of trying to pack the"
  156. 1560  PRINT TAB(T);
  157. 1570  PRINT "theoretical maximum number of wires into any appreciable length"
  158. 1580  PRINT TAB(T);
  159. 1590  PRINT "of conduit."
  160. 1600  RETURN
  161. 1610  '
  162. 1620  '.....end
  163. 1630  GOSUB 1670
  164. 1640  CLS:GOTO 120
  165. 1650  END
  166. 1660  '
  167. 1670  'HARDCOPY
  168. 1680  GOSUB 1790:LOCATE 25,2:COLOR 14,6
  169. 1690  PRINT " Press 1 to print screen, 2 to print screen & ";
  170. 1700  PRINT "advance paper, or 3 to continue.";:COLOR 7,0
  171. 1710  Z$=INKEY$:IF Z$="3"THEN GOSUB 1790:RETURN
  172. 1720  IF Z$="1"OR Z$="2"THEN GOSUB 1790:GOTO 1740
  173. 1730  GOTO 1710
  174. 1740  FOR QX=1 TO 24:FOR QY=1 TO 80
  175. 1750  LPRINT CHR$(SCREEN(QX,QY));
  176. 1760  NEXT QY:NEXT QX
  177. 1770  IF Z$="2"THEN LPRINT CHR$(12)
  178. 1780  GOTO 1680
  179. 1790  LOCATE 25,1:PRINT STRING$(80,32);:RETURN
  180.